<#include "../../common/_header.htm">
<div class="content-wrapper" style="margin-left: 0px">
        <section class="content">
                <div id="call_frequency_law" >
                    <div class="stream_search" >
                        <el-form :inline="true" ref="call_Form" :model="form" class="demo-form-inline">
                            <el-form-item label="对方号码">
                                <el-input v-model="form.PARTY_NUMBER" placeholder="对方号码"></el-input>
                            </el-form-item>
                            <el-form-item class="form_z" label="时间范围">
                                <el-date-picker
                                        v-model="form.begin_time"
                                        name="beginTime"
                                        type="date"
                                >
                                </el-date-picker>
                            </el-form-item>
                            <el-form-item class="el-form-item refsh" label="至">
                                <el-date-picker
                                        v-model="form.end_time"
                                        name="endTime"
                                        type="date"
                                >
                                </el-date-picker>
                            </el-form-item>
                            <div class="zcdcon">
                            <el-form-item>
                                <el-button type="primary" @click="onSubmit">分析</el-button>
                            </el-form-item>
                            <el-form-item>
                                <el-button  @click="clear()">重置</el-button>
                            </el-form-item>
                            <el-form-item>
                                <el-button type="primary" class="daobtn" @click="exportExcel">导出</el-button>
                            </el-form-item>
                            </div>
                        </el-form>
                    </div>

                    <div class="stream_body" >

                        <div v-show="showType===0">
                            <table id="dg"></table>
                        </div>

                </div>

        </section>
    </div>
    <script>
	    var caseId=parent.caseId;
			 $(window).resize(function(){
				$('#dg').datagrid('resize',{
                    height:($(window).height())-($('.stream_search').outerHeight(true))-30,
                });
			});
        //d3弹窗
        function show(){
            call_frequency_law.getlist_d3();
        }
        //地图弹窗
        function showMap(){
            $("#hidebg-map").show();
            $("#hidebox-map").show();
            call_frequency_law.getMap();
        }
        function hideMap(){
            $("#hidebg-map").hide();
            $("#hidebox-map").hide();
        }

        let call_frequency_law=new Vue({
            el:"#call_frequency_law",
            data:{
                typeOptions:[
                    {
                        value: '0',
                        label: '主叫'
                    }, {
                        value: '1',
                        label: '被叫'
                    }
                ],
                showType:0,
                form: {
                    PARTY_NUMBER: '',
                    FREQUENCY_COUNT: '',
                    begin_time:"",
                    end_time:"",
                },
            },
            methods: {
                changeMap(){
                    this.showType=2;
                    if(arr){
                        this.getMap();
                    }
                },
                onSubmit() {
                    _checkedCallback()
                },
                clear(formName){
                    this.form={
                        PARTY_NUMBER: '',
                        FREQUENCY_COUNT: '',
                        begin_time:"",
                        end_time:"",
                    }
                },
                exportExcel(){
                    if(arr){
                        let a = "PARTY_NUMBER="+this.form.PARTY_NUMBER+"&begin_time="+getMyDate(this.form.begin_time)+"&end_time="+getMyDate(this.form.end_time)+"&SERVICE_NUMBER="+arr+"&CASEMANAGE_ID="+caseId;
                        window.location.href="${ctx}/callanalysis/export/law?"+a;
                    }
                },
                getMap(){
                    request({
                        url: 'callanalysis/frequency_law_map',
                        method: 'post',
                        data:{
                            SERVICE_USER_INFORMATION:this.form.SERVICE_USER_INFORMATION,//对方姓名
                            PARTY_NUMBER: this.form.PARTY_NUMBER,// 对方号码
                            begin_time: getMyDate(this.form.begin_time),// 开始时间
                            end_time: getMyDate(this.form.end_time),// 结束时间
                            SERVICE_NUMBER:arr,
                            CASEMANAGE_ID:caseId
                        }
                    }).then(result=>{
                        if(result.data.data.mapData&&result.data.data.mapData.code==20000){
                            initMap("hidebox-mContent",result.data.data.mapData)
                        }else{
                            initMap("hidebox-mContent",{})
                        }
                    })
                },
                getlist_d3(){
                	var data = {
                			SERVICE_USER_INFORMATION : this.form.SERVICE_USER_INFORMATION,//对方姓名
                            PARTY_NUMBER : this.form.PARTY_NUMBER,// 对方号码
                            begin_time : getMyDate(this.form.begin_time),// 开始时间
                            end_time : getMyDate(this.form.end_time),// 结束时间
                            SERVICE_NUMBER : arr,
                            CASEMANAGE_ID:caseId,
                            reqUrl : '${ctx}/callanalysis/detail_d3'
                    }
                	var d = top.dialog({
                        title : '通话规律分析关系图',
                        modal : true,
                        data : data,
                        url : '${ctx}/callanalysis/callAnalysisD3Init',
                        height : 800,
                        width : 1500,
                        onshow : function () {
                    	}
                    });
                    d.show();
                	return false;
                },
            }
        })
        var arr=""
        _checkedCallback()
        function _checkedCallback() {
            if(parent.parent._checkedPhone.length==1){
                var temArr=deepClone(parent.parent._checkedPhone);
                for (let i = 0; i < temArr.length; i++) {
                    if (temArr[i].indexOf("'")==-1) {
                        temArr[i]="'"+temArr[i]+"'"
                    }
                }
                arr = temArr.toString()
                dg();
            }else{
                call_frequency_law.$message('请选择1个电话信息');
                arr=""
                dg()
            }
        }
        function detailDialog(DATE_HOUR) {
            if (arr&&arr.indexOf('\'')!=-1) {
                arr=arr.substring(1,arr.length-1)
            }
            var param = {
                SERVICE_NUMBER:arr,// 主叫号码
                PARTY_NUMBER : call_frequency_law.form.PARTY_NUMBER,// 对方号码
                DATE_HOUR:DATE_HOUR,// 时间段
                CASEMANAGE_ID:caseId
            };
            var d = top.dialog({
                title : '通话规律分析详情',
                modal : true,
                url : '${ctx}/phone/record/compeopledetailDialog',
                height : 700,
                width : 1500,
                data : param,
                onshow : function () {
                }
            });
            d.show();
            return false;
        }
        /*-----------------------easyui表格-----------------------------*/
        /** 页面初始化完成 **/
        function dg(){
            $('#dg').datagrid({
                url: '${ctx}callanalysis/frequency_law_easyui',
                method: 'post',
                queryParams:{//每次请求的参数
                    serviceUserInformation:call_frequency_law.form.SERVICE_USER_INFORMATION,//对方姓名
                    partyNumber: call_frequency_law.form.PARTY_NUMBER,// 对方号码
                    beginTime: getMyDate(call_frequency_law.form.begin_time),// 开始时间
                    endTime: getMyDate(call_frequency_law.form.end_time),// 结束时间
                    serviceNumber:arr,
                    caseId:caseId
                },
                pageSize:30,
                pageList:[30,50,100,150,200],
                pageNumber:1,//当前页号,
                //sortName:"TOTALMONEY",//排序列名称 设置后将向后台传送名为sort的post/get参数
                //sortOrder:"desc",//排序列升降序 设置后将向后台传送名为order的post/get参数

                loadMsg:"正在加载，请稍后",//加载数据时的提示信息
                emptyMsg:"暂无信息",//加载数据为空时的信息
                height: ($(window).height())-($('.stream_search').outerHeight(true))-30,
                rownumbers:true,//序号
                fitColumns: true,//使表格自适应页面宽度
                //pagination: true,//是否分页
                singleSelect: true,
                columns:[[ //每一列的具体设置。
                    {field:'time',title:'日期'},
                    {field:'t00',title:'00',
                        formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t01',title:'01',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t02',title:'02',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t03',title:'03',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t04',title:'04',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t05',title:'05',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t06',title:'06',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t07',title:'07',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t08',title:'08',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t09',title:'09',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t10',title:'10',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t11',title:'11',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t12',title:'12',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t13',title:'13',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t14',title:'14',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t15',title:'15',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t16',title:'16',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t17',title:'17',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t18',title:'18',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t19',title:'19',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t20',title:'20',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t21',title:'21',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t22',title:'22',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'t23',title:'23',
                         formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                            var count = value.COUNT;
                            if (count){
                                return "<a onclick='detailDialog(\""+value.DAY+"\")'>"+count+"</a>";
                            }
                        }
                    },
                    {field:'total',title:'合计'}
                ]],
                onHeaderContextMenu: function(e, field){
                    e.preventDefault();
                    if (!cmenu){
                        createColumnMenu();
                    }
                    cmenu.menu('show', {
                        left:e.pageX,
                        top:e.pageY
                    });
                },
                onLoadSuccess: function(){
                    // console.log("刷新了")
                }
            });
        }
    </script>
    <script src="${ctx}/bower_components/easyui/common/titleHide.js"></script>
    <style>
        .casemanage-switch .casemanage-list i{
            width: 20px;
            height: 16px;
        }
        .casemanage-list {
            line-height: 35px;
            color: #fff;
        }
        .casemanage-switch .casemanage-relative i{
            width: 20px;
            height: 20px;
            display: inline-block;
        }
        .casemanage-relative{
            line-height: 35px;
        }
        span.plist {
            position: absolute;
        }
        .casemanage-switch.casemanage-switchcon {
            position: absolute;
        }
        .stream_body {
            margin-top: 25px;
        }
        button.el-button.daobtn.el-button--primary{
            background-color: #23B7E5;
            border-color: #23B7E5;
        }
        .zcdcon {
            display: inline-block;
        }
        button.el-button.el-button--primary{
            width: 70px;
            height: 30px;
            line-height: 8px;
        }
        button.el-button.el-button--default{
            width: 70px;
            height: 30px;
            line-height: 8px;
        }
        .el-form-item {
            margin-bottom: -20px;
        }
        #hidebg-map {
            position:absolute;
            left:0px;
            top:0px;
            background-color:#000;
            width: 100%;
            height: 100%;
            filter:alpha(opacity=60);  /*设置透明度为60%*/
            opacity:0.6;  /*非IE浏览器下设置透明度为60%*/
            display:none;
            z-Index:999;
        }
        #hidebox-map {
            text-align: right;
            position:absolute;
            width: 96%;
            height: 82%;
            top: 23px;
            left: 2%;
            border-radius: 5px;
            background-color:#fff;
            display:none;
            z-Index:9999;
            padding: 10px;
        }
        div#hidebox-mContent {
            width: 100%;
            height: 96%;
        }
        .outAccount_d3_head {
            float: left;
            font-size: 20px;
            margin-bottom: 5px;
        }
        #hidebox span{
            font-size: 20px;
        }
        svg {
            height: 96%;
            width: 100%;
        }
        .casemanage-relative:focus {
            border-color: #4695ed;
        }
        .el-table.el-table--fit.el-table--striped.el-table--enable-row-hover {
            border-radius: 4px;
        }
        .el-form-item.form-z {
            margin-right: 7px !important;
        }
        .el-input__inner{
            font-size: 12px;
        }
        .stream_search{
            margin: 0 0 15px 0;
        }
        .el-form-item__label{
            color: #6f7689;
        }
        .el-button{
            padding: 8px 15px;
            width: 70px;
            height: 32px;
        }
        .el-button:focus, .el-button:hover {
            background-color: #e7e7e7;
            border-color: #adadad;
        }
        button.el-button.el-button--default:hover {
            color: #333;
        }
        button.el-button.el-button--default:focus {
            color: #333;
        }
        .el-button:active {
            border-color: #adadad;
            background-color: #e7e7e7;
        }
        .el-dialog--small{
            width: 88%;
        }
        .el-button--primary{
            background-color:#4695ed;
            border-color:#4695ed;
        }
        .el-button--primary:focus, .el-button--primary:hover{
            background: #61a8f5;
            border-color: #61a8f5;
        }
        .casemanage-switch .casemanage-list{
            border-top-right-radius: 0;
            border-bottom-right-radius: 0;
            border-top-left-radius: 5px;
            border-bottom-left-radius: 5px;
        }
        .el-input__inner{
            border-color: #D2D6DE;
            border-color: #e4e4e4;
        }
        .el-input__inner:hover{
            border-color:#4695ed;
        }
        .el-input__inner:focus{
            border-color:#4695ed;
        }
        .el-select:hover .el-input__inner{
            border-color:#4695ed;
        }
        .content {
            padding: 10px;
        }
        .el-dialog--small {
            width: 95%;
            margin-top: 68px;
        }
        .el-pagination {
            font-weight: 400;
            margin-top: 10px;
        }
        .el-dialog__headerbtn{
            font-size: 20px;
            top: 30px;
            right: 30px;
        }
        .el-dialog__header {
            margin-top: 15px;
        }
    </style>
